from flask_restplus import Api
from .user import api as user_ns
from .blog import api as blog_ns
from .auth import api as auth_ns
from .comment import api as comment_ns

DEFAULT_NAMESPACES = (
    (user_ns, '/users'),
    (blog_ns, '/blogs'),
    (auth_ns, '/auth'),
    (comment_ns, '/comments')
)


# 配置资源
def config_resource(app):
    api = Api(
        app,
        version='0.1',
        title='xxx系统接口',
        description='xxx系统接口描述',
        doc='/'
    )
    for namespace, path in DEFAULT_NAMESPACES:
        api.add_namespace(namespace, path)
